home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / mplus_1.exe / GDDEMO.C < prev    next >
C/C++ Source or Header  |  1991-12-01  |  3KB  |  90 lines

  1. /*--------------------------------------------------------------
  2.  *  File:           GDDEMO.C
  3.  *  Description:    Program to demonstrate MPLUS dialog boxes.
  4.  *
  5.  *  This demo developed for the MPLUS Graphic Interface Library.
  6.  *-------------------------------------------------------------*/
  7.  
  8. #include <graph.h>
  9. #include "gscreen.h"
  10. #include "gplus.h"
  11.  
  12. /*--------------------------------------------------------------
  13.  *  Function:       main
  14.  *  Description:    open the three standard dialog boxes.
  15.  *  Return value:   0
  16.  *--------------------------------------------------------------*/
  17. main()
  18. {
  19.     int option;
  20.  
  21.     /* if( setvideomode( _HRESBW ) == 0 ) */    /* for you CGA people out there */
  22.     if( setvideomode( _ERESCOLOR ) == 0 )
  23.     {
  24.         printf("\nProgram requires EGA mode.\n");
  25.         exit(1);
  26.     }
  27.     /* setvideomode( _MRES4COLOR ); */
  28.     ms_reset();                         /* reset mouse */
  29.     ms_setevent(1);
  30.     ms_showcursor();                    /* show it */
  31.  
  32.     /*      Show info box
  33.      */
  34.     gdialog( GDINFORM, GDOKCAN );
  35.     gdwrite( "Information box with two options.\n" );
  36.     gdwrite( "Colors are a calm blue on white.\n" );
  37.     gdwrite( "There are 4 lines of text available.\n");
  38.     gdwrite( "This is line 4." );
  39.     option = gdprompt();
  40.     gdclose();
  41.  
  42.     gdialog( GDINFORM, GDOKAY );
  43.     if( option == 0 )
  44.         gdwrite( "You selected \"OKAY\"" );
  45.     else
  46.         gdwrite( "You selected \"CANCEL\"" );
  47.     option = gdprompt();
  48.     gdclose();
  49.  
  50.  
  51.     /*      Show warning box.
  52.      */
  53.     gdialog( GDWARN, GDYESNO );
  54.     gdwrite( "This is the Warning box.\n" );
  55.     gdwrite( "Good for \"Are you sure?\" conditions\n" );
  56.     gdwrite( "Only 3 lines available." );
  57.     option = gdprompt();
  58.     gdclose();
  59.  
  60.     gdialog( GDINFORM, GDOKAY );
  61.     if( option == 0 )
  62.         gdwrite( "You selected \"YES\"" );
  63.     else
  64.         gdwrite( "You selected \"NO\"" );
  65.     option = gdprompt();
  66.     gdclose();
  67.  
  68.     /*      Show error box.
  69.      */
  70.     gdialog( GDERROR, GDOKAY );
  71.     gdwrite( "Error box.  Maybe you'd like to add an\n");
  72.     gdwrite( "alarm.  Only three lines of text\n" );
  73.     gdwrite( "available." );
  74.     option = gdprompt();
  75.     gdclose();
  76.  
  77.     gdialog( GDINFORM, GDOKAY );
  78.     gdwrite( "You could only select \"OKAY\"" );
  79.     gdprompt();
  80.     gdclose();
  81.  
  82.     setvideomode( _DEFAULTMODE );
  83.     ms_reset();
  84.  
  85.     exit(0);
  86. }
  87. /*-------------------------------------------------------------*
  88.  *                      End of GDDEMO.C                        *
  89.  *-------------------------------------------------------------*/
  90.